import request from '@/utils/request'

// 查询内容帖列表（弃用）
export function listContent(query) {
	return request({
		url: '/bbsAdmin/content/list',
		method: 'get',
		params: query
	})
}

// 查询内容帖列表（新）
export function listContentVo(query) {
	return request({
		url: '/bbsAdmin/content/contentVoList',
		method: 'get',
		params: query
	})
}

export function listByTreeContent(query) {
	return request({
		url: '/bbsAdmin/content/listByTree',
		method: 'get',
		params: query
	})



}

// 查询内容帖详细
export function getContent(contentid) {
	return request({
		url: '/bbsAdmin/content/' + contentid,
		method: 'get'
	})
}

// 新增内容帖
export function addContent(data) {
	return request({
		url: '/bbsAdmin/content',
		method: 'post',
		data: data
	})
}

// 修改内容帖
export function updateContent(data) {
	return request({
		url: '/bbsAdmin/content',
		method: 'put',
		data: data
	})
}

// 删除内容帖
export function delContent(contentid) {
	return request({
		url: '/bbsAdmin/content/' + contentid,
		method: 'delete'
	})
}

//生成校园信息贴
export function createSchoolInfos(query) {
	return request({
		baseURL: '/remoteApi',
		url: '/commonAPIs/createSchoolInfos',
		method: 'post',
		data: query,
		header: {
		      "Content-type": "application/json",
		    },
	})
}
// export const createSchoolInfos = (data) => request({
// 	baseURL: '/remoteApi',
// 	url: '/commonAPIs/createSchoolInfos',
// 	data,
// 	method: 'post'
// })

//根据帖子ID删除redis中缓存的某个帖子
export function deletePostInRedisById(query) {
	return request({
		url: '/bbsAdmin/content/deletePostInRedisById',
		method: 'get',
		params: query
	})
}

//删除redis中缓存的置顶帖子
export function deleteTopPostInRedis(query) {
	return request({
		url: '/bbsAdmin/content/deleteTopPostInRedis',
		method: 'get',
		params: query
	})
}

//删除redis中缓存的首页帖子列表
export function deletePostListInRedis(query) {
	return request({
		url: '/bbsAdmin/content/deletePostListInRedis',
		method: 'get',
		params: query
	})
}

//重置redis中缓存的首页帖子列表
export function updateHomePostListInRedis(query) {
	return request({
		url: '/bbsAdmin/content/updateHomePostListInRedis',
		method: 'get',
		params: query
	})
}

//重置redis中缓存的首页帖子列表
export function updatePostInfoInRedisById(query) {
	return request({
		url: '/bbsAdmin/content/updatePostInfoInRedisById',
		method: 'get',
		params: query
	})
}

// 查询内容帖列表（新）
export function listAllSchoolContentVo(query) {
	return request({
		url: '/bbsAdmin/content/allSchoolContentVoList',
		method: 'get',
		params: query
	})
}

export function getHotPostList(query) {
	return request({
		url: '/bbsAdmin/content/getHotPostList',
		method: 'get',
		params: query
	})
}
